﻿/* PN264 - A Parallel H.264 Encoding Utility
 * Copyright © 2009 PN264 Development Team
 *
 * This software is released under the terms and conditions of the MIT License,
 * a copy of which can be found in the License.txt file.
 */
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net;
using System.Net.Sockets;

namespace PN264.Net
{
    public sealed class MessageServer
    {
        #region Constructors
        public MessageServer(ushort port)
        {
            this.port = port;
        }
        #endregion
        #region Fields
        private ushort port;
        private TcpListener tcpListener;
        private UdpClient udpListener;
        #endregion
        #region Methods - Private
        private void TcpAcceptCallback(IAsyncResult result)
        {

        }
        private void UdpReceiveCallback(IAsyncResult result)
        {
        }
        #endregion
        #region Methods

        public void Start()
        {
            this.tcpListener = new TcpListener(IPAddress.Loopback, port);
            this.udpListener = new UdpClient(port);

            this.tcpListener.BeginAcceptTcpClient(new AsyncCallback(this.TcpAcceptCallback), null);
            this.udpListener.BeginReceive(new AsyncCallback(this.UdpReceiveCallback), null);
        }
        #endregion
        #region Properties
        public ushort Port
        {
            get
            {
                return this.port;
            }
        }
        #endregion
    }
}
